const path = require("path");
const resolve = dir => path.join(__dirname, ".", dir);
const webpack = require("webpack");

module.exports = {
  lintOnSave: false, //关闭代码错误检测
  publicPath: "./", //打包工程需要的配置
  configureWebpack: {
    plugins: [
      new webpack.ProvidePlugin({
        "window.Quill": "quill/dist/quill.js",
        Quill: "quill/dist/quill.js"
      })
    ]
  },
  productionSourceMap: false,

  chainWebpack: config => {
    config.module
      .rule("svg")
      .exclude.add(resolve("src/assets/icons/svg"))
      .end();

    config.module
      .rule("icons")
      .test(/\.svg$/)
      .include.add(resolve("src/assets/icons/svg"))
      .end()
      .use("svg-sprite-loader")
      .loader("svg-sprite-loader")
      .options({
        symbolId: "icon-[name]"
      });
  }
};
